ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Skylark_Clutch Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Clutch:
Skylark_Base TAnimal TALMaSSObject

Public Member Functions

virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
 Skylark_Clutch (Skylark_Female *Mum, SkTerritories *Terrs, Landscape *L, int NoEggs, int x, int y, int mh, Skylark_Population_Manager *SPM)
 
virtual void ReInit (Skylark_Female *Mum, SkTerritories *Terrs, Landscape *L, int NoEggs, int x, int y, int mh, Skylark_Population_Manager *SPM)
 
void OnMumGone ()
 
void AddEgg ()
 
void StartDeveloping ()
 
- Public Member Functions inherited from Skylark_Base
 Skylark_Base (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual double On_FoodSupply (double)
 
void AddStriglingMort (int lifestage)
 
virtual int WhatState ()
 
bool InSquare (rectangle R)
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Public Attributes

int Clutch_Size
 
Skylark_FemaleMother
 
- Public Attributes inherited from Skylark_Base
double m_pesticide_accumulation
 
double m_pcide_conc
 
TTypesOfSkState m_CurrentSkState
 
int Age
 
double m_Size
 
int m_Born_x
 
int m_Born_y
 
int m_MyHome
 The vegetation type where the skylark was born. More...
 
SkTerritoriesm_OurTerritories
 
Skylark_Population_Managerm_OurPopulationManager
 

Protected Member Functions

int st_Developing ()
 
int st_Hatching ()
 
void st_Dying ()
 
virtual bool OnFarmEvent (FarmToDo event)
 
- Protected Member Functions inherited from Skylark_Base
bool DailyMortality (int mort)
 
virtual void PesticideResponse ()
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int MinDegrees
 
int m_baddays
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Constructor & Destructor Documentation

◆ Skylark_Clutch()

Skylark_Clutch::Skylark_Clutch ( Skylark_Female Mum,
SkTerritories Terrs,
Landscape L,
int  NoEggs,
int  x,
int  y,
int  mh,
Skylark_Population_Manager SPM 
)
2494  : Skylark_Base( x, y, Terrs, L, SPM, x, y, m_MyHome ) {
2495  Age = 0;
2496  Clutch_Size = NoEggs;
2497  MinDegrees = 0;
2498  Mother = Mum;
2499  m_baddays = 0;
2500 }
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:600
int Age
Definition: skylarks_all.h:595
Skylark_Base(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2435
int m_baddays
Definition: skylarks_all.h:645
int MinDegrees
Definition: skylarks_all.h:644
int Clutch_Size
Definition: skylarks_all.h:669
Skylark_Female * Mother
Definition: skylarks_all.h:670

References Skylark_Base::Age, Clutch_Size, m_baddays, MinDegrees, and Mother.

Member Function Documentation

◆ AddEgg()

void Skylark_Clutch::AddEgg ( )
inline
657  {
658  Clutch_Size++;
659  }

Referenced by Skylark_Female::st_Laying().

◆ BeginStep()

void Skylark_Clutch::BeginStep ( void  )
virtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

2676  {
2677  CheckManagement();
2678 }
void CheckManagement(void)
Definition: PopulationManager.cpp:1404

References TAnimal::CheckManagement().

◆ EndStep()

void Skylark_Clutch::EndStep ( void  )
virtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

2717  {
2718 #ifdef __CJTDebug_5
2719  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2720 #endif
2721  if ( m_CurrentSkState == toss_Destroy ) return;
2722  switch ( m_CurrentSkState ) {
2723  case toss_Initiation:
2724  break;
2725  case toss_Developing: // Develop
2726  switch ( st_Developing() ) {
2727  case 2:
2728 #ifdef TEST_ISSUE_DEATH_WARRANT
2729  printf( "Skylark_Clutch::EndStep() st_Developing() %d\n", ( int )g_date->Date() );
2730 #endif
2731  m_CurrentSkState = toss_CDying; // die
2732  break;
2733  case 1:
2734  m_CurrentSkState = toss_Hatching; // hatch
2735  break;
2736  case 0:
2737  break;
2738  }
2739  break;
2740  case toss_Hatching: // Hatching
2741  switch ( st_Hatching() ) {
2742  case 0:
2743 #ifdef TEST_ISSUE_DEATH_WARRANT
2744  printf( "Skylark_Clutch::EndStep() st_Hatching() %d\n", ( int )g_date->Date() );
2745 #endif
2747  break;
2748  case 1: // Successful hatch
2749  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2750  m_CurrentStateNo = -1;
2751  m_StepDone = true; // otherwise it will loop forever
2752  break;
2753  }
2754  break;
2755  case toss_CDying: // Dying
2756  st_Dying();
2757  m_StepDone = true;
2758  break;
2759  default:
2760  char errornum[ 20 ];
2761  sprintf( errornum, "%d", m_CurrentSkState );
2762  g_land->Warn( "Skylark_Clutch::EndStep(): Unknown state: ", errornum );
2763  exit( 0 );
2764  break;
2765  }
2766 }
class Calendar * g_date
Definition: calendar.cpp:38
long Date(void)
Definition: calendar.h:57
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:594
int st_Developing()
Definition: skylarks_all.cpp:2769
int st_Hatching()
Definition: skylarks_all.cpp:2881
void st_Dying()
Definition: skylarks_all.cpp:2917
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
Landscape * g_land
This pointer provides access the to landscape module.
Definition: skylarks_all.cpp:49
@ toss_Initiation
Definition: skylarks_all.h:45
@ toss_Developing
Definition: skylarks_all.h:47
@ toss_Destroy
Definition: skylarks_all.h:62
@ toss_CDying
Definition: skylarks_all.h:47
@ toss_Hatching
Definition: skylarks_all.h:47

References Calendar::Date(), g_date, g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, TALMaSSObject::m_StepDone, st_Developing(), st_Dying(), st_Hatching(), toss_CDying, toss_Destroy, toss_Developing, toss_Hatching, toss_Initiation, and Landscape::Warn().

◆ OnFarmEvent()

bool Skylark_Clutch::OnFarmEvent ( FarmToDo  event)
protectedvirtual

Reimplemented from TAnimal.

2513  {
2514  switch ( event ) {
2515  case sleep_all_day:
2516  break;
2517  case autumn_plough:
2518  case autumn_harrow:
2519  case autumn_roll:
2520  case autumn_sow:
2521  case winter_plough:
2522  case deep_ploughing:
2523  case spring_plough:
2524  case spring_harrow:
2525  case spring_roll:
2526  case spring_sow:
2527  case fp_liquidNH3:
2528  case fp_greenmanure:
2529  case row_cultivation:
2530  case hilling_up:
2531  case harvest:
2532  case cut_to_hay:
2533  case cut_to_silage:
2534  case straw_chopping:
2535  case hay_turning:
2537  case burn_straw_stubble:
2538  case mow:
2539 #ifdef TEST_ISSUE_DEATH_WARRANT
2540  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2541 #endif
2543  break;
2544 
2545  case fp_npks:
2546  case fp_npk:
2547  case fp_pk:
2548  case fp_manganesesulphate:
2549  case fp_manure:
2550  case fp_sludge:
2551  case fa_npk:
2552  case fa_pk:
2553  case fa_ammoniumsulphate:
2554  case fa_manure:
2555  case fa_greenmanure:
2556  case fa_sludge:
2557  case herbicide_treat:
2558  case growth_regulator:
2559  case fungicide_treat:
2560  case insecticide_treat:
2562  case syninsecticide_treat:
2563  if ( random( 1000 ) < cfg_insecticide_direct_mortE.value() ) {
2564 #ifdef TEST_ISSUE_DEATH_WARRANT
2565  printf( "Skylark_Female::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2566 #endif
2568  }
2569  break;
2570  case molluscicide:
2571  case water:
2572  case hay_bailing:
2573  case stubble_harrowing:
2574  case cut_weeds:
2575  break;
2576 
2577  case fp_slurry:
2578  case fa_slurry:
2579  case swathing:
2580  if ( random( 100 ) < 2 ) {
2581 #ifdef TEST_ISSUE_DEATH_WARRANT
2582  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2583 #endif
2585  }
2586  break;
2587 
2588  case strigling:
2589 #ifndef __NoStriglingEffect
2590  if ( random( 100 ) < cfg_strigling_clutch.value() ) {
2591  #ifdef TEST_ISSUE_DEATH_WARRANT
2592  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2593  #endif
2595  AddStriglingMort( 1 );
2596  }
2597 #endif
2598  break;
2599 
2600 
2601  case cattle_out:
2603  if ( random( 1000 ) < 20 ) { // was 20
2604 #ifdef TEST_ISSUE_DEATH_WARRANT
2605  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2606 #endif
2608  }
2609  break;
2610 
2611  case cattle_out_low:
2613  if ( random( 1000 ) < 5 ) { //was 5
2614 #ifdef TEST_ISSUE_DEATH_WARRANT
2615  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2616 #endif
2618  }
2619  break;
2620 
2621  case pigs_out:
2622 #ifndef __NoPigsOutEffect
2623  if ( random( 100 ) < 20 ) {
2624  #ifdef TEST_ISSUE_DEATH_WARRANT
2625  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2626  #endif
2628  }
2629 #endif
2630  break;
2631 
2632  case strigling_sow:
2633 #ifndef __NoStriglingEffect
2634  if ( random( 100 ) < cfg_strigling_clutch.value() ) {
2635  #ifdef TEST_ISSUE_DEATH_WARRANT
2636  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2637  #endif
2639  AddStriglingMort( 1 );
2640  }
2641 #endif
2642  break;
2643 
2644  case product_treat:
2645  break;
2646  case glyphosate:
2647  break;
2648 
2649  default:
2650  g_land->Warn( "Skylark_Clutch::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
2651  exit( 1 );
2652  }
2653  if ( m_CurrentSkState == toss_CDying ) return true; else
2654  return false;
2655 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
int value(void)
Definition: configurator.h:98
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
int SupplyGrazingPressure(int a_polyref)
Definition: landscape.h:1227
void AddStriglingMort(int lifestage)
Definition: skylarks_all.h:611
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
CfgInt cfg_insecticide_direct_mortE
CfgInt cfg_strigling_clutch
@ burn_straw_stubble
Definition: treatment.h:92
@ autumn_harrow
Definition: treatment.h:37
@ swathing
Definition: treatment.h:81
@ fa_pk
Definition: treatment.h:62
@ winter_plough
Definition: treatment.h:42
@ strigling
Definition: treatment.h:77
@ fp_npks
Definition: treatment.h:48
@ glyphosate
Definition: treatment.h:102
@ fa_sludge
Definition: treatment.h:68
@ fp_liquidNH3
Definition: treatment.h:51
@ spring_roll
Definition: treatment.h:46
@ fa_greenmanure
Definition: treatment.h:67
@ spring_plough
Definition: treatment.h:44
@ molluscicide
Definition: treatment.h:75
@ syninsecticide_treat
Definition: treatment.h:99
@ hay_turning
Definition: treatment.h:88
@ autumn_roll
Definition: treatment.h:38
@ fp_manure
Definition: treatment.h:55
@ deep_ploughing
Definition: treatment.h:43
@ pigs_out
Definition: treatment.h:84
@ fa_npk
Definition: treatment.h:61
@ herbicide_treat
Definition: treatment.h:71
@ row_cultivation
Definition: treatment.h:76
@ spring_sow
Definition: treatment.h:47
@ fungicide_treat
Definition: treatment.h:73
@ fp_manganesesulphate
Definition: treatment.h:53
@ harvest
Definition: treatment.h:82
@ cut_to_silage
Definition: treatment.h:86
@ sleep_all_day
Definition: treatment.h:33
@ mow
Definition: treatment.h:93
@ fa_ammoniumsulphate
Definition: treatment.h:65
@ autumn_plough
Definition: treatment.h:34
@ straw_chopping
Definition: treatment.h:87
@ fa_manure
Definition: treatment.h:66
@ fp_greenmanure
Definition: treatment.h:56
@ fa_slurry
Definition: treatment.h:63
@ product_treat
Definition: treatment.h:101
@ stubble_harrowing
Definition: treatment.h:90
@ hilling_up
Definition: treatment.h:79
@ growth_regulator
Definition: treatment.h:72
@ insecticide_treat
Definition: treatment.h:74
@ trial_insecticidetreat
Definition: treatment.h:96
@ cattle_out_low
Definition: treatment.h:100
@ cut_to_hay
Definition: treatment.h:85
@ cut_weeds
Definition: treatment.h:94
@ fp_sludge
Definition: treatment.h:57
@ autumn_sow
Definition: treatment.h:41
@ fp_npk
Definition: treatment.h:49
@ fp_pk
Definition: treatment.h:50
@ hay_bailing
Definition: treatment.h:89
@ spring_harrow
Definition: treatment.h:45
@ strigling_sow
Definition: treatment.h:95
@ cattle_out
Definition: treatment.h:83
@ fp_slurry
Definition: treatment.h:52
@ water
Definition: treatment.h:80
@ autumn_or_spring_plough
Definition: treatment.h:91

References Skylark_Base::AddStriglingMort(), autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, burn_straw_stubble, cattle_out, cattle_out_low, cfg_insecticide_direct_mortE, cfg_strigling_clutch, cut_to_hay, cut_to_silage, cut_weeds, Calendar::Date(), deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_greenmanure, fa_manure, fa_npk, fa_pk, fa_sludge, fa_slurry, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_sludge, fp_slurry, fungicide_treat, g_date, g_land, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, herbicide_treat, hilling_up, insecticide_treat, Skylark_Base::m_CurrentSkState, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, molluscicide, mow, pigs_out, product_treat, random(), row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, straw_chopping, strigling, strigling_sow, stubble_harrowing, Landscape::SupplyGrazingPressure(), swathing, syninsecticide_treat, toss_CDying, trial_insecticidetreat, CfgInt::value(), Landscape::Warn(), water, and winter_plough.

◆ OnMumGone()

void Skylark_Clutch::OnMumGone ( void  )
2660  {
2661 #ifdef __CJTDebug_5
2662  if ( IsAlive() != 0x0DEADC0DE )
2663  DEADCODEError();
2664 #endif
2665  // the clutch cannot survive so go directly to die and do not pass go
2666  Mother = NULL;
2667 #ifdef TEST_ISSUE_DEATH_WARRANT
2668  printf( "Skylark_Clutch::OnMumGone() %d\n", ( int )g_date->Date() );
2669 #endif
2670  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2671  m_CurrentStateNo = -1;
2672 }

References Calendar::Date(), g_date, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, Mother, and toss_Destroy.

Referenced by Skylark_Female::OnMateDying(), Skylark_Female::OnMateHomeless(), Skylark_Female::st_Dying(), Skylark_Female::st_GivingUpTerritory(), Skylark_Female::st_StartingNewBrood(), Skylark_Female::st_StoppingBreeding(), and Skylark_Female::Step().

◆ ReInit()

void Skylark_Clutch::ReInit ( Skylark_Female Mum,
SkTerritories Terrs,
Landscape L,
int  NoEggs,
int  x,
int  y,
int  mh,
Skylark_Population_Manager SPM 
)
virtual
2503  {
2504  Skylark_Base::ReInit(x, y, Terrs, L, SPM, x, y, a_MyHome);
2505  Age = 0;
2506  Clutch_Size = NoEggs;
2507  MinDegrees = 0;
2508  Mother = Mum;
2509  m_baddays = 0;
2510 }
virtual void ReInit(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2449

References Skylark_Base::Age, Clutch_Size, m_baddays, MinDegrees, Mother, and Skylark_Base::ReInit().

◆ st_Developing()

int Skylark_Clutch::st_Developing ( )
protected
2769  {
2770 #ifdef __CJTDebug_5
2771  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2772 #endif
2773  if ( DailyMortality( ClutchMortProb ) ) {
2774 #ifdef __SKPOM
2776 #endif
2777  return 2; //transfer to state die
2778  }
2779  if ( Age > 0 ) // No development on the first day when just laid
2780  {
2781  // Timing : This function is called once at the end of each day before
2782  // the next day
2783  // Develop according to ambient temperature, and how long the female
2784  // is incubating for
2785  int incubated_time = Mother->Supply_NestTime(); // this includes night
2786  int off_nest_time = 24 * 60 - incubated_time;
2787  //double Rain = m_OurLandscape->SupplyRain();
2788  //int Daylength = m_OurLandscape->SupplyDaylength();
2789 
2790  //m_OurPopulationManager->WriteToTest2File(m_OurLandscape->SupplyDayInYear(),off_nest_time);
2791  // they start at EggTemp degrees and cool to 'cool'
2792  double cool_rate_pmin = Cooling_Rate_Eggs / 60.0;
2793  double Temp = m_OurLandscape->SupplyTemp(); // 9.97 = COrrection for day/night temps in �tjylland
2794  if ( Temp >= EggTemp ) Temp = EggTemp - 0.000001;
2795 
2796  // If off_nest_time > daylength/2 then the birds are spending more time off the nest than on.
2797  // in this case the trip length must go up
2798  //double TripNumber=cfg_FoodTripsPerDay.value();
2799  double TripLength=cfg_sk_triplength.value();
2800 /*
2801  if ( off_nest_time >= ( Daylength - 10 ) ) { // -10 allows us not to get a division by zero later
2802  if ( ++m_baddays > 5 ) {
2803  #ifdef __SKPOM
2804  m_OurPopulationManager->WriteSKPOM1( m_OurLandscape->SupplyDayInYear(), 1003 );
2805  #endif
2806  return 2; //TransferToState(Die);
2807  }
2808  } else {
2809  if ( off_nest_time > ( Daylength / 2.0 ) ) {
2810  // getting cold, so assume a different strategy or maximising the number of on nest times of 10 minutes
2811  int on_nest = Daylength - off_nest_time;
2812  TripNumber = on_nest / 10.0;
2813  TripLength = off_nest_time / TripNumber;
2814  }
2815  else {
2816  TripLength = 10;
2817  }
2818  }
2819  */
2820  //
2821  // We have the time incubated - but this includes re-warming time. So make
2822  // the assumption that warming/cooling are linear and equal rates
2823  // Now calculate the minimum temperature
2824  // double cool = EggTemp - ( ( cool_rate_pmin * TripLength ) * ( ( EggTemp - Temp ) / 2.0 ) );
2825  double cool = EggTemp - ( ( cool_rate_pmin * TripLength ) * ( ( EggTemp - Temp ) / 2.0 ) );
2826  // This cannot be lower than ambient (There is a problem here since ambient
2827  // temperature when the eggs are not incubated is higher than the mean used
2828  // here because foraging is in the daytime
2829  if ( cool < Temp ) cool = Temp;
2830  // Now calculate how many minutes were spent cooling down to this temp (if
2831  // cool is higher than Temp then cooltime should be the same as TripLength
2832  // Next line to prevent overflow
2833  double cooltime = ( EggTemp - cool ) / ( cool_rate_pmin * ( ( EggTemp - Temp ) / 2.0 ) );
2834  // Eggs will spend incubated time-cooltime at EggTemp, off_nest_time-cooltime
2835  // at cool, and 2xcooltime at the mean of EggTemp and cool
2836  double AverageOffNestTemp = ( cool + EggTemp ) / 2.0;
2837  /* if ( Rain > 5 ) { MinDegrees += ( ( 24 * 60 ) - Daylength ) * ( EggTemp - MD_Threshold ); if ( m_baddays++ > 5 ) {
2838  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 );
2839  return 2; //TransferToState(Die); } } else */
2840  {
2841  MinDegrees += (int) (( incubated_time - ( cooltime * 2.0 ) ) * ( EggTemp - MD_Threshold )); // took *2 away
2842  double offnesttemp = cool - MD_Threshold;
2843  if ( offnesttemp < 0 ) offnesttemp = 0; // No development, rather than minus
2844  MinDegrees += int (( off_nest_time - cooltime ) * ( offnesttemp ));
2845  double transitiontemp = (int) AverageOffNestTemp - MD_Threshold;
2846  if ( transitiontemp < 0 ) transitiontemp = 0; // No development, rather than minus
2847  MinDegrees += (int) (( 2.0 * cooltime ) * ( transitiontemp )); // was 1.0 - this change assumes immediate re-heating
2848  }
2849  /* double scalingfactor = 1.0; int Daylength = m_OurLandscape->SupplyDaylength( );
2850  int daytimeonnest=Daylength-off_nest_time; double Rain = m_OurLandscape->SupplyRain(); if (Rain >10) {
2851  MinDegrees+=(24*60)-Daylength; if (m_baddays++>5) {
2852  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 ); return 2; //TransferToState(Die); } }
2853  else { if ((daytimeonnest * scalingfactor) >= off_nest_time) { MinDegrees+=24*60; // No problem, got all day } else {
2854  if (daytimeonnest<=0) { MinDegrees+=incubated_time; if (m_baddays++>5) {
2855  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 ); return 2; //TransferToState(Die);
2856  }; // This counter just keeps going up until death } else { // Here we have used some time being cold, but not too much
2857  int uncompensatedtime=off_nest_time-(daytimeonnest*scalingfactor);
2858  MinDegrees+=(24*60)-uncompensatedtime; // Only part of the day } } } */
2859  }
2860 
2861  // Have we achieved enough minute degrees
2862  if ( MinDegrees > MD_Hatch ) {
2863 #ifdef __SKPOM
2865 #endif
2866  return 1; //TransferToState(Hatch);
2867  } else // if they reach the age of 18 they die if not hatched
2868  if ( Age == 18 ) {
2869 #ifdef __SKPOM
2871 #endif
2872  return 2; //TransferToState(Die);
2873  } else {
2874  Age++;
2875  return 0;
2876  }
2877 }
double value(void)
Definition: configurator.h:118
double SupplyTemp(void)
Definition: landscape.h:1386
int SupplyDayInYear(void)
Definition: landscape.h:1596
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:603
bool DailyMortality(int mort)
Definition: skylarks_all.cpp:2464
int Supply_NestTime()
Definition: skylarks_all.h:818
void WriteSKPOM1(int n, int n2)
Definition: skylarks_all.h:479
CfgFloat cfg_sk_triplength
static double EggTemp
Definition: skylarks_all.cpp:181
static int ClutchMortProb
Definition: skylarks_all.cpp:176
static double MD_Hatch
Definition: skylarks_all.cpp:186
static double Cooling_Rate_Eggs
Definition: skylarks_all.cpp:180
static double MD_Threshold
Definition: skylarks_all.cpp:182

References Skylark_Base::Age, cfg_sk_triplength, ClutchMortProb, Cooling_Rate_Eggs, Skylark_Base::DailyMortality(), EggTemp, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, MD_Hatch, MD_Threshold, MinDegrees, Mother, Skylark_Female::Supply_NestTime(), Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), CfgFloat::value(), and Skylark_Population_Manager::WriteSKPOM1().

Referenced by EndStep().

◆ st_Dying()

void Skylark_Clutch::st_Dying ( void  )
protected
2917  {
2918 #ifdef __CJTDebug_5
2919  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2920 #endif
2921  // Timing: Zero time
2922  // Only called before object is destroyed
2923  if ( Mother ) Mother->OnClutchDeath();
2924  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2925  m_CurrentStateNo = -1;
2926 }
void OnClutchDeath()
Definition: skylarks_all.cpp:5990

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, Mother, Skylark_Female::OnClutchDeath(), and toss_Destroy.

Referenced by EndStep().

◆ st_Hatching()

int Skylark_Clutch::st_Hatching ( )
protected
2881  {
2882 #ifdef __CJTDebug_5
2883  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2884 #endif
2885  // Timing: Occurs at the end of a day (e.g. midnight-1 minute)
2886  // Must create Clutch_Size number of Skylark_Hatchling Objects
2887  // They tell Mother that they have been created when they exist in the system
2888 
2889  Nestling_struct * Ch;
2890  if ( Mother->Paired ) {
2891  Ch = new Nestling_struct;
2892  Ch->Dad = Mother->MyMate; // Needs a pointer to dad not mum
2893  Ch->x = m_Location_x;
2894  Ch->y = m_Location_y;
2895  Ch->L = m_OurLandscape;
2896  Ch->Terrs = m_OurTerritories;
2897  Ch->bx = m_Born_x;
2898  Ch->by = m_Born_y;
2899  Ch->mh = m_MyHome;
2900 #ifdef __CJTDebug_7
2901  if ( Clutch_Size == 0 ) {
2902  g_land->Warn( "Skylark_Clutch::st_Hatching(): DeBug7 ", NULL ); exit( 1 );
2903  }
2904 #endif
2905  m_OurPopulationManager->CreateObjects( 1, this, NULL, Ch, Clutch_Size );
2906  // object destroyed by m_OurPopulationManager
2907  delete Ch;
2908  Mother->OnEggsHatch(); // Sets in motion feeding and she tells male
2909  return 1;
2910  } else {
2911  return 0;
2912  }
2913 }
Definition: skylarks_all.h:228
Skylark_Male * Dad
Definition: skylarks_all.h:230
bool Paired
Definition: skylarks_all.h:752
int m_Born_y
Definition: skylarks_all.h:598
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:602
int m_Born_x
Definition: skylarks_all.h:597
void OnEggsHatch()
Definition: skylarks_all.cpp:6012
Skylark_Male * MyMate
Definition: skylarks_all.h:806
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:557
int bx
Definition: skylarks_all.h:200
Landscape * L
Definition: skylarks_all.h:203
int x
Definition: skylarks_all.h:198
SkTerritories * Terrs
Definition: skylarks_all.h:204
int y
Definition: skylarks_all.h:199
int mh
Definition: skylarks_all.h:202
int by
Definition: skylarks_all.h:201

References Skylark_struct::bx, Skylark_struct::by, Clutch_Size, Skylark_Population_Manager::CreateObjects(), Nestling_struct::Dad, g_land, Skylark_struct::L, Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_struct::mh, Mother, Skylark_Female::MyMate, Skylark_Female::OnEggsHatch(), Skylark_Adult::Paired, Skylark_struct::Terrs, Landscape::Warn(), Skylark_struct::x, and Skylark_struct::y.

Referenced by EndStep().

◆ StartDeveloping()

void Skylark_Clutch::StartDeveloping ( )
inline
662  {
664  // Must tell the pop man how many eggs were made
666  }
void incTotalEggs(int eggs)
Definition: skylarks_all.h:537

References toss_Developing.

Referenced by Skylark_Female::st_Laying().

◆ Step()

void Skylark_Clutch::Step ( void  )
virtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

2682  {
2683 #ifdef __CJTDebug_5
2684  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2685 #endif
2686  if ( m_StepDone || m_CurrentSkState == toss_Destroy ) return;
2687 #ifdef __CJTDebug_5
2688  if ( Mother ) {
2689  if ( Mother->SupplyMyClutch() != this ) {
2690  g_land->Warn( "Skylark_Step::Step(): Debug_5 ", "" );
2691  exit( 1 );
2692  }
2693  }
2694 #endif
2695  switch ( m_CurrentSkState ) {
2696  case toss_Initiation: // Initial state. Will wait here until told by female that she is incubatig
2697  m_StepDone = true;
2699  break;
2700  case toss_Developing:
2701  m_StepDone = true;
2702  break;
2703  case toss_Hatching:
2704  m_StepDone = true;
2705  break;
2706  case toss_CDying:
2707  m_StepDone = true;
2708  break;
2709  default:
2710  g_land->Warn( "Skylark_CLutch::Step(): Unknown State ", "" );
2711  exit( 1 );
2712  }
2713 }
Skylark_Clutch * SupplyMyClutch()
Definition: skylarks_all.h:823

References g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_StepDone, Mother, Skylark_Female::SupplyMyClutch(), toss_CDying, toss_Destroy, toss_Developing, toss_Hatching, toss_Initiation, and Landscape::Warn().

Member Data Documentation

◆ Clutch_Size

int Skylark_Clutch::Clutch_Size

Referenced by ReInit(), Skylark_Clutch(), and st_Hatching().

◆ m_baddays

int Skylark_Clutch::m_baddays
protected

Referenced by ReInit(), and Skylark_Clutch().

◆ MinDegrees

int Skylark_Clutch::MinDegrees
protected

◆ Mother


The documentation for this class was generated from the following files: